<template>
    <!-- 添加或修改工序对话框 -->
    <el-dialog :title="title" :visible.sync="open" width="80%" append-to-body :close-on-click-modal="false" v-dialogDrag>
        <el-form ref="form" :model="form" :rules="rules" label-width="120px">
            <el-tabs v-model="activeName" class="detail-tab" type="card">
                <el-tab-pane label="基本信息" name="first">
                    <el-row :gutter="24">
                       <el-row :gutter="24">
                    <el-col :span="12">
                      <el-form-item label="工序产品名称" prop="gongxuName">
                        <el-input v-model="form.gongxuName" placeholder="请输入工序产品名称"/>
                      </el-form-item>
                    </el-col>
                  </el-row>
                      <el-col :span="24">
                        <el-form-item label="图纸号" prop="shuoming">
                          <el-input v-model="form.shuoming" type="textarea" placeholder="请输入图纸号"/>
                        </el-form-item>
                      </el-col>
                    </el-row>
                 
                </el-tab-pane>
            </el-tabs>
        </el-form>
        <div slot="footer" class="dialog-footer">
            <el-button type="primary" @click="submitForm">确 定</el-button>
            <el-button @click="cancel">取 消</el-button>
        </div>
    </el-dialog>
</template>

<script>
    import { addAction, getById, updateAction,getAction } from '@/api/manage';
    import moment from 'moment';

    export default {
        name: "piliangEditGongXuForm",
        dicts: ['shebei_list'],
        data() {
            return {
                // 遮罩层
                loading: true,
                activeName: "first",
                // 弹出层标题
                title: "",
                // 是否显示弹出层
                open: false,
                // 表单参数
                form: {},
                queryParams: {},
                // 表单校验
                rules: {

                },
                url: {
                    editAll:'/goodsSaledoGongxu/goodsSaledoGongxu/editAllTuzhihao',
                },
            };
        },
        created() {
        },
        methods: {
          selectShebei(value) {
            let that = this;
            that.$nextTick(() => {
              let arr = that.$refs.myselectShebei;
              for (let i = 0; i < arr.length; i++) {
                if (arr[i].currentValue == value) {
                  //that.form.kehuName = arr[i].label;
                }
              }
            })
          },

            // 取消按钮
            cancel() {
                this.open = false;
                this.reset();
            },
            // 表单重置
            reset() {
                this.form = {
                  id: null,
                  ids: null,
                  code: null,
                  name: null,
                  money: null,
                  delFlag: null,
                  createBy: null,
                  createTime: null,
                  updateBy: null,
                  updateTime: null,
                  remark: null,
                  shuoming: null,
                  file: null,
                  photo: null,
                  status: "0",
                /*  haveGongyi: null,
                  isZhijian: null,
                  readyDate: null,
                  prodDate: null,
                  endDate: null,
                  zhijianDate: null*/
                };
                this.resetForm("form");
            },

            /** 修改按钮操作 */
            handleUpdate(ids) {
                this.reset();
                this.form.ids=ids;
                this.open = true;
            },
            /** 提交按钮 */
            submitForm() {
                this.$refs["form"].validate(valid => {
                    if (valid) {
                        if (this.form.ids != null) {
                            updateAction(this.url.editAll, this.form).then(response => {
                                this.$modal.msgSuccess("修改成功");
                                this.open = false;
                                this.$emit('ok');
                            });
                        }
                    }
                });
            },
        }
    };
</script>
